/**
 * 
 */
package pt.mleiria.network;

/**
 * @author NB13712
 *
 */
public enum Command {
	LEFT (0x01),
	RIGHT (0x02),
	FORWARD (0x03),
	BACK (0x04),
	STOP (0x00);
	
	private final int cmd;
	
	private Command(int cmd){
		this.cmd = cmd;
	}
	/**
	 * 
	 * @return the command cmd in hexa
	 */
	public int getCmd() {
		return cmd;
	}
	
	public static Command parse(int cmdId) {
        for (Command item : Command.values()) {
            if (item.getCmd() == cmdId)
                return item ;
        }
        return null ;
    }

}
